//
//  PersonalHeaderView.m
//  联付商圈
//
//  Created by 韩佳睿 on 2017/7/18.
//  Copyright © 2017年 lianfu. All rights reserved.
//

#import "PersonalHeaderView.h"
#import "MyWalletViewController.h"

@interface PersonalHeaderView()

@property (weak, nonatomic) IBOutlet UIButton *mailBtn;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *levelLabel;
@property (weak, nonatomic) IBOutlet UIImageView *headerView;
@property (weak, nonatomic) IBOutlet UIButton *vipCardBtn;
@property (weak, nonatomic) IBOutlet UIButton *attentionBtn;
@property (weak, nonatomic) IBOutlet UIButton *saleBtn;
@property (weak, nonatomic) IBOutlet UITapGestureRecognizer *myOrderBtn;
@property (weak, nonatomic) IBOutlet UITapGestureRecognizer *obligationBtn;
@property (weak, nonatomic) IBOutlet UITapGestureRecognizer *evaluateBtn;
@property (weak, nonatomic) IBOutlet UITapGestureRecognizer *refundBtn;

@end

@implementation PersonalHeaderView

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self prepareSubviews];
    [self addTapGestureRecognizer];
}

- (void)prepareSubviews {
    self.headerView.layer.cornerRadius = 20;
}

- (void)addTapGestureRecognizer {
    [self.myOrderBtn addTarget:self action:@selector(myOrderAction)];
    [self.obligationBtn addTarget:self action:@selector(obligationAction)];
    [self.evaluateBtn addTarget:self action:@selector(evaluateAction)];
    [self.refundBtn addTarget:self action:@selector(refundAction)];
}

- (void)renderCellWithUserModel:(SQUserModel *)model {
//#warning data load
//    self.nameLabel.text = model.userName;
//    self.levelLabel.text = model.userLevel;
//    self.headerView.image = [UIImage imageNamed:model.userImage];
    self.nameLabel.text = @"白天不懂夜的黑";
    self.levelLabel.text = @"★ 4 ";

}

#pragma mark - Action

- (void)mailAction {
    if ([self.delegate respondsToSelector:@selector(mailBtnAction)]) {
        [self.delegate mailBtnAction];
    }
}

- (void)vipCardAcion {
    if ([self.delegate respondsToSelector:@selector(vipCardBtnAction)] ) {
        [self.delegate vipCardBtnAction];
    }
}

- (void)attentionAction {
    if ([self.delegate respondsToSelector:@selector(attentionBtnAction)]) {
        [self.delegate attentionBtnAction];
    }
}

- (void)saleAction {
    if ([self.delegate respondsToSelector:@selector(saleBtnAction)]) {
        [self.delegate saleBtnAction];
    }
}

- (void)myOrderAction {
    if ([self.delegate respondsToSelector:@selector(myOrderBtnAction)]) {
        [self.delegate myOrderBtnAction];
    }
}

- (void)obligationAction {
    if ([self.delegate respondsToSelector:@selector(obligationBtnAction)]) {
        [self.delegate obligationBtnAction];
    }
}

- (void)evaluateAction {
    if ([self.delegate respondsToSelector:@selector(evaluateBtnAction)]) {
        [self.delegate evaluateBtnAction];
    }
}

- (void)refundAction {
    if ([self.delegate respondsToSelector:@selector(refundBtnAction)]) {
        [self.delegate refundBtnAction];
    }
}

@end
